diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 20:12:40 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 20:12:40 -0500 |
| commit | 6f077f141edcc45f2d7467b7c796e62a8f0316f8 (patch) | |
| tree | 617f8883be6140eac9827bde5c600f85606d85f9 /src/app/groups/[groupId]/edit | |
| parent | fb6cff2fe3101e80d2932285c0b03e0d5be872f8 (diff) | |
Prevent removing participants with expenses
Diffstat (limited to 'src/app/groups/[groupId]/edit')
| -rw-r--r-- | src/app/groups/[groupId]/edit/page.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/app/groups/[groupId]/edit/page.tsx b/src/app/groups/[groupId]/edit/page.tsx index 1fcf225..be1a5a8 100644 --- a/src/app/groups/[groupId]/edit/page.tsx +++ b/src/app/groups/[groupId]/edit/page.tsx @@ -1,5 +1,5 @@ import { GroupForm } from '@/components/group-form' -import { getGroup, updateGroup } from '@/lib/api' +import { getGroup, getGroupExpensesParticipants, updateGroup } from '@/lib/api' import { groupFormSchema } from '@/lib/schemas' import { Metadata } from 'next' import { notFound, redirect } from 'next/navigation' @@ -23,5 +23,12 @@ export default async function EditGroupPage({ redirect(`/groups/${group.id}`) } - return <GroupForm group={group} onSubmit={updateGroupAction} /> + const protectedParticipantIds = await getGroupExpensesParticipants(groupId) + return ( + <GroupForm + group={group} + onSubmit={updateGroupAction} + protectedParticipantIds={protectedParticipantIds} + /> + ) } |
